package com.csii.activiti.server.abstraction.ipml;

import com.csii.activiti.server.abstraction.entity.ActRole;
import com.csii.activiti.server.abstraction.service.ActRoleService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class ActRoleServiceImpl implements ActRoleService {

    private List<ActRole> roles = new ArrayList<>();

    {
        roles.add(new ActRole("角色","role"));
        roles.add(new ActRole("角色1","role1"));
        roles.add(new ActRole("角色2","role2"));
        roles.add(new ActRole("角色3","role3"));
        roles.add(new ActRole("角色4","role4"));
        roles.add(new ActRole("角色5","role5"));
        roles.add(new ActRole("角色6","role6"));
        roles.add(new ActRole("角色7","role7"));
        roles.add(new ActRole("角色8","role8"));
        roles.add(new ActRole("角色9","role9"));
        roles.add(new ActRole("角色10","role10"));
        roles.add(new ActRole("角色11","role11"));
        roles.add(new ActRole("角色12","role12"));
        roles.add(new ActRole("角色13","role13"));

    }

    @Override
    public List<ActRole> queryRoleLikeRoleName(String roleName) {
        return roles.stream().filter(item->item.getRoleName().contains(roleName)).collect(Collectors.toList());
    }

    @Override
    public List<ActRole> queryRoleByRoleCodes(Set<String> roleCodes) {
        return roles.stream().filter(item->roleCodes.contains(item.getRoleCode())).collect(Collectors.toList());
    }
}
